package hikari.objects_data;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * @author sad
 */
public class Model3dData {

    public static class AnimationTrackData {

        private int startFrame;
        private int endFrame;
        private float animationSpeed;

        public AnimationTrackData(int startFrame, int endFrame, float animationSpeed) {
            this.startFrame = startFrame;
            this.endFrame = endFrame;
            this.animationSpeed = animationSpeed;
        }

        public int getStartFrame() {
            return startFrame;
        }

        public void setStartFrame(int startFrame) {
            this.startFrame = startFrame;
        }

        public int getEndFrame() {
            return endFrame;
        }

        public void setEndFrame(int endFrame) {
            this.endFrame = endFrame;
        }

        public float getAnimationSpeed() {
            return animationSpeed;
        }

        public void setAnimationSpeed(float animationSpeed) {
            this.animationSpeed = animationSpeed;
        }
    };
    private Map<String, AnimationTrackData> animationTracks = new HashMap<>();

    public void clearAnimationData() {
        animationTracks.clear();
    }

    public String[] getAnimationNames() {
        ArrayList<String> aNames = new ArrayList<>();
        for (String aName : animationTracks.keySet()) {
            aNames.add(aName);
        }
        return aNames.toArray(new String[0]);
    }
    
    public AnimationTrackData getTrackData(String name){
        return animationTracks.get(name);
    }

    public void putAnimationTrack(String trackName, int animStart, int animEnd, float speed) {
        animationTracks.put(trackName, new AnimationTrackData(animStart, animEnd, speed));
    }
}
